package org.sample.springbootrabbitmq.queue;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Exchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QueueConfiguration {

	@Bean
	public Queue textQueue() {
		return new Queue("textQueue");
	}

	@Bean
	public Exchange userEventExchange() {
		return new TopicExchange("userEventExchange");
	}

	@Bean
	public Queue itemEventQueue() {
		return new Queue("itemEventQueue");
	}

	@Bean
	public Exchange itemEventExchange() {
		return new TopicExchange("itemEventExchange");
	}

	@Bean
	public Binding eventBinding(Queue itemEventQueue, Exchange itemEventExchange) {
		return BindingBuilder.bind(itemEventQueue).to(itemEventExchange).with("item.*").noargs();
	}

}
